﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace stud.DataAccess
{
    public class Queries
    {
        public bool ValidateUser(string usr, string pas)
        {

            //code fetch from database

            Dictionary<string, string> users = new Dictionary<string, string>();
            users.Add("arun", "123");
            users.Add("barun", "321");

            var usrInfo = users.Where(u => u.Key.Equals(usr)).FirstOrDefault();
            if (usrInfo.Value.Equals(pas))
                return true;
            else
                return false;

        }

        public string GetRoleFoTheUser(string usr)
        {

            //code fetch from database
            List<RoleInfo> useRoleSet = new List<RoleInfo>();

            useRoleSet.Add(new RoleInfo { User = "arun", Role = "sa" });
            useRoleSet.Add(new RoleInfo { User = "barun", Role = "admin" });

            var roleInfo = useRoleSet.Where(u => u.User.Equals(usr)).FirstOrDefault();
            return roleInfo.Role;
        }
    }
    public class RoleInfo
    {
        public string User { get; set; }
        public string Role { get; set; }
    }
}
